<!-- 绿色通道 - 患者列表 - 医疗记录 主界面 -->
<template>
  <div id="box">
    <div class="topLine" style="">
      <div class="blueDot" style="" />
      <div style="float: left; margin-top: 8px"><span style="text-align: left; font-size: 20px; margin-left: 8px">医疗记录</span></div>
      <div class="fanhui_btn" style="float: right">
        <el-button type="info" plain @click="routerBack()">
          <span class="iconfont icon-fanhui" />
          返回
        </el-button>
      </div>
      <div style="clear: both" />
    </div>
    <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
      <el-tab-pane label="急救进程" name="process"><process v-if="activeName == 'process'" :checkrowdata="mrdata" /></el-tab-pane>
      <el-tab-pane v-if="consultation == false" label="远程会诊" name="remoteConsultation"><remoteConsultation v-if="activeName == 'remoteConsultation'" patient-type="卒中" :checkrowdata="mrdata" /></el-tab-pane>

      <el-tab-pane v-if="consultation == false" label="基本信息" name="info"><info-stroke v-if="activeName == 'info'" :checkrowdata="mrdata" /></el-tab-pane>
      <el-tab-pane v-if="consultation == false" label="急诊接诊" name="emergencyTreatment"><emergency-treatment v-if="activeName == 'emergencyTreatment'" patient-type="卒中" :checkrowdata="mrdata" /></el-tab-pane>
      <el-tab-pane v-if="consultation == false" label="生命体征" name="vitalSign"><vitalSign v-if="activeName == 'vitalSign'" patient-type="卒中" :checkrowdata="mrdata" /></el-tab-pane>
      <el-tab-pane v-if="consultation == false" label="主诉与病史" name="medicalHistoryStroke">
        <medicalHistoryStroke v-if="activeName == 'medicalHistoryStroke'" :checkrowdata="mrdata" />
      </el-tab-pane>
      <el-tab-pane v-if="consultation == false" label="评分项目" name="scoreItem">
        <scoreItem v-if="activeName == 'scoreItem'" :checkrowdata="mrdata" />
      </el-tab-pane>
      <el-tab-pane v-if="consultation == false" label="NIHSS" name="nihssScoreStroke">
        <nihssScoreStroke v-if="activeName == 'nihssScoreStroke'" :checkrowdata="mrdata" />
      </el-tab-pane>

      <el-tab-pane v-if="consultation == false" label="辅助检查" name="accessoryExaminationStroke">
        <accessoryExaminationStroke v-if="activeName == 'accessoryExaminationStroke'" :checkrowdata="mrdata" />
      </el-tab-pane>

      <el-tab-pane v-if="consultation == false" label="血液检查" name="bloodExaminationStroke">
        <bloodExaminationStroke v-if="activeName == 'bloodExaminationStroke'" :checkrowdata="mrdata" />
      </el-tab-pane>

      <el-tab-pane v-if="consultation == false" label="诊断评估" name="diagnosticEstimateStroke">
        <diagnostic-estimate-stroke v-if="activeName == 'diagnosticEstimateStroke'" :checkrowdata="mrdata" />
      </el-tab-pane>

      <el-tab-pane v-if="consultation == false" label="治疗" name="treatmentStroke">
        <treatment-stroke v-if="activeName == 'treatmentStroke'" :checkrowdata="mrdata" />
      </el-tab-pane>

      <el-tab-pane v-if="consultation == false" label="其他处置" name="otherDisposalStroke">
        <otherDisposalStroke v-if="activeName == 'otherDisposalStroke'" :checkrowdata="mrdata" />
      </el-tab-pane>

      <el-tab-pane v-if="consultation == false" label="知情同意" name="informedConsentList">
        <informedConsentList v-if="activeName == 'informedConsentList'" :checkrowdata="mrdata" />
      </el-tab-pane>

      <el-tab-pane v-if="consultation == false" label="患者转归" name="outcomeStroke"><outcome-stroke v-if="activeName == 'outcomeStroke'" :checkrowdata="mrdata" /></el-tab-pane>

      <!-- 新版页面,仅在会诊中使用 -->
      <el-tab-pane v-if="consultation == true" label="基本信息" name="basicInfoStoke"><basicInfoStoke v-if="activeName == 'basicInfoStoke'" :checkrowdata="mrdata" /></el-tab-pane>

      <el-tab-pane label="上报表单" name="strokeChoose"><strokeChoose v-if="activeName == 'strokeChoose'" :checkrowdata="mrdata" /></el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
import process from '@/views/green-channel/process.vue'
import infoStroke from '@/views/green-channel/infoStroke.vue'
import remoteConsultation from '@/views/green-channel/remoteConsultation.vue'
import emergencyTreatment from '@/views/green-channel/emergencyTreatment.vue'
import vitalSign from '@/views/green-channel/vitalSign.vue'
import medicalHistoryStroke from '@/views/green-channel/medicalHistoryStroke.vue'
// import checkUp from '@/views/green-channel/checkUp.vue'
import nihssScoreStroke from '@/views/green-channel/nihssScoreStroke.vue'
import accessoryExaminationStroke from '@/views/green-channel/accessoryExaminationStroke.vue'
import bloodExaminationStroke from '@/views/green-channel/bloodExaminationStroke.vue'
import strokeChoose from '@/views/green-channel/strokeChoose.vue'
import basicInfoStoke from '@/views/green-channel/basicInfoStoke.vue'
import otherDisposalStroke from '@/views/green-channel/otherDisposalStroke.vue'
import informedConsentList from '@/views/green-channel/informedConsentList.vue'
import diagnosticEstimate from '@/views/green-channel/diagnosticEstimate.vue'
import diagnosticEstimateStroke from '@/views/green-channel/diagnosticEstimateStroke.vue'
import outcomeStroke from '@/views/green-channel/outcomeStroke.vue'
import treatmentStroke from '@/views/green-channel/treatmentStroke.vue'
import scoreItem from '@/views/green-channel/scoreItem.vue'

export default {
  // 由主页面(父组件) 接收来的, 选择项的数据
  components: {
    process,
    infoStroke,
    remoteConsultation,
    emergencyTreatment,
    vitalSign,
    medicalHistoryStroke,
    // checkUp,
    nihssScoreStroke,
    accessoryExaminationStroke,
    bloodExaminationStroke,
    strokeChoose,
    basicInfoStoke,
    otherDisposalStroke,
    informedConsentList,
    diagnosticEstimate,
    diagnosticEstimateStroke,
    outcomeStroke,
    treatmentStroke,
    scoreItem
  },
  props: ['mrdata'],
  data() {
    return {
      activeName: 'process',
      consultation: false // 是否由会诊tab页进入
    }
  },
  computed: {},
  updated() {},
  created() {
    console.log('接受要传的值', this.mrdata)
    console.log('是否由会诊tab页进入', this.mrdata.isConsultation) // true或false
    if (this.mrdata.isConsultation) {
      this.consultation = this.mrdata.isConsultation
      this.activeName = 'basicInfoStoke'
    }
    if (this.mrdata.state === 'creating') {
      this.activeName = 'info'
    }
  },
  mounted() {
    if (!!this.$store.getters.consultationsId && this.$store.getters.dataBus.dispatchId) {
      // cid有值 && dastabus有值
      // this.checkData = this.$store.getters.dataBus // checkData赋值
      this.consultation = true
      this.activeName = 'basicInfoStoke'
    }
  },
  methods: {
    handleClick(e, a) {
      // console.log(e, a)
      // console.log(this.activeName.toString())
      // console.log(this.activeName === 'strokeChoose')
    },
    routerBack() {
      this.$emit('medicalRecordsStrokeToFather') // 提醒父组件切换页面,达成返回效果
      // this.$emit('homePageToFather', data.dispatchId, data.patientId)
      // console.log(this.$router)
      // this.$router.back()
      // this.$router.go(-1) // 后退
      // debugger
      // this.$router.push('/green-channel/medicalRecords')
      // 接受子组件传来的dispatchId,patientId
      // console.log('传来的数据', dispatchId, patientId)
    }
  }
}
</script>

<style scoped>
.topLine {
  background-color: rgb(255, 255, 255);
  color: rgb(57, 68, 85);
  overflow: hidden;
  z-index: 9999;
  padding: 10px 20px;
  text-align: center;
  border-bottom: 10px solid rgb(242, 242, 242);
}

.blueDot {
  width: 15px;
  height: 15px;
  line-height: 30px;
  background-color: rgb(67, 128, 234);
  border-radius: 50%;
  float: left;
  margin-top: 15px;
}
</style>
